package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teaching.domain.PlatformUVirtualLearnTime;
import com.ruoyi.teaching.service.PlatformUVirtualLearnTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2025-02-19
 */
@RestController
@RequestMapping("/platform/virtualLearnTime")
@Api(tags = "platform-虚拟仿真学习时长管理")
public class PlatformUVirtualLearnTimeController {
    @Autowired
    private PlatformUVirtualLearnTimeService platformUVirtualLearnTimeService;

    /**
     * 分页获取所有学习时长记录
     */
    @GetMapping("/listPage")
    @ApiOperation(value = "分页获取所有学习时长记录",notes = "分页获取所有学习时长记录")
    public AjaxResult listPage(Integer pageNum, Integer pageSize, Long productId) {
        return platformUVirtualLearnTimeService.listPage(pageNum,pageSize,productId);
    }

    /**
     * 新增学习时长
     */
    @PostMapping("/addLearnTime")
    @ApiOperation(value = "新增学习时长",notes = "新增学习时长")
    @Log(title = "【新增学习时长】", businessType = BusinessType.INSERT)
    public AjaxResult addLearnTime(@RequestBody PlatformUVirtualLearnTime platformUVirtualLearnTime) {
        return platformUVirtualLearnTimeService.addLearnTime(platformUVirtualLearnTime);
    }

    /**
     * 删除学习时长
     */
    @DeleteMapping("/deleteLearnTime/{id}")
    @ApiOperation(value = "删除学习时长",notes = "删除学习时长")
    @Log(title = "【删除学习时长】", businessType = BusinessType.DELETE)
    public AjaxResult deleteLearnTime(@PathVariable Long id) {
        return platformUVirtualLearnTimeService.deleteLearnTime(id);
    }

}

